package com.example.shiwuyouproject.ui.fragment.my.activity.viewmodel
import androidx.lifecycle.MutableLiveData
import com.example.shiwuyouproject.base.BaseViewModel
import com.example.shiwuyouproject.ui.bean.RewardsAndHonorsCoomitBean
import com.example.shiwuyouproject.ui.my.bean.PersonalInformationBean
class RewardsAndHonorsViewModel:BaseViewModel() {
    private val getRealNameAuthenticatioApi by lazy { RetrofitClient.getApiService() }
    val getGenRenStatus = MutableLiveData<PersonalInformationBean>()
    fun getRealNameAuthenticationData(){
        launch(
            block = {
                val codeStatus = getRealNameAuthenticatioApi.userUpdate()
                getGenRenStatus.value=codeStatus.result()
            },
            error = {
            },
            cancel = {

            },
            showErrorToast = false
        )
    }
    val getPostStatus = MutableLiveData<Boolean>()
    /**
     * 保存奖励荣誉
     *
     */
    fun preservationCard(honor:String,honorimg:MutableList<String>
                        ){
      val hashMap: HashMap<String, String> =  HashMap()
        hashMap["honor"] = honor
        hashMap["honorimg"] = honorimg.toString().replace("[","")
            .replace("]","")
        launch(
            block = {

                val codeStatus = getRealNameAuthenticatioApi.addUserUpdateSava(hashMap)
                getPostStatus.value=codeStatus.success()
            },
            error = {
                getPostStatus.value=false
            },
            cancel = {
                getPostStatus.value=false
            },
            showErrorToast = false
        )

    }
}